class CreateProducts < ActiveRecord::Migration
  def self.up
    create_table :products do |t|
      t.references :category
      t.references :brand
      t.references :abstract_product
      t.string :uuid, :limit => 36
      t.string :name
      t.string :model,:limit=>50
      t.integer :sn
      t.string :image_url
      t.integer :quantity
      t.decimal :purchase_price,:precision => 8, :scale => 2, :default => 0
      t.decimal :cost_price,:precision => 8, :scale => 2, :default => 0
      t.decimal :retail_price,:precision => 8, :scale => 2, :default => 0
      t.text :description
      t.integer :sort_order,:limit=>2
      t.boolean :active,:default=>true

      t.timestamps
    end
  end

  def self.down
    drop_table :products
  end
end
